package com.mark.web.data.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Description: 自定义SpringMVC全局异常处理类
 * @Author: Mark
 * @CreateDate: 2018/4/21.
 * @Version: 2.0
 * @Copyright : 豆浆油条个人非正式工作室
 */
@Slf4j
public class ExceptionResolver implements HandlerExceptionResolver {

    @Override
    public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
       // log.error("The Request:{} Exception:--> ",request.getRequestURI(),ex);
       // ModelAndView modelAndView = new ModelAndView(new MappingJacksonJsonView());//注意：当使用是jackson2.x的时候使用MappingJackson2JsonView
       // modelAndView.addObject("status", ResponseCode.Exception.getCode());
       // modelAndView.addObject("msg","接口异常，请联系后端维护人员");
       // modelAndView.addObject("data",ex.toString());
        return null;
    }
}
